<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>新建调查</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="{{asset('layui/css/layui.css')}}" media="all">
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <script type="text/javascript" src="{{asset('Jquery/jquery-3.3.1.js')}}"></script>
</head>
<body>
<script src="{{asset('layui/layui.js')}}"></script>
<form  class="layui-form" action="{{url('saveHouses')}}" method="post">
    @csrf
    <table class="layui-table">
        <thead>
        <tr>
            <th colspan="2" style="font-size: 18px;text-align: center;color:#666666">新建调查</th>
        </tr>
        <tr>
            <th style="text-align: center;color:#666666;font-size: 14px;width: 130px">
                <label >所属项目:</label>
            </th>

            <th style="width: 400px">
                <div class="layui-inline">
                    <div class="layui-input-inline">
                        <select name="project_id" lay-filter="aihao" >
                            <option value="">请选择所属项目名称</option>
                            @foreach($allProject as $k=>$project)
                                <option value="{{$project->id}}">{{$project->name}}</option>
                            @endforeach
                        </select>
                    </div>
                </div>
                </div>

                @if($errors->has('survey_id'))
                    <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('survey_id')}}</sapn></span>
                @endif

            </th>
        </tr>
        <tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label>房屋征收编号:</label></th>
            <th>
                <div>
                    <input type="text" name="levy_house_num" required  value="{{old('levy_house_num')?old('levy_house_num'):Session::get('levy_house_num')}}" lay-verify="required" placeholder="请输入房屋征收编号，例如:No.20181208003" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('levy_house_num'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('levy_house_num')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>
        <tr>

            <th style="text-align: center;color:#666666;font-size: 14px"><label>产权人姓名:</label></th>
            <th>
                <div>
                    <input type="text" name="owner" required  value="{{old('owner')?old('owner'):Session::get('owner')}}" lay-verify="required" placeholder="请输入产权人姓名，如：张三" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('owner'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('owner')}}</sapn></span>
                    @endif
                </div>
            </th>

        </tr>

        <tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label>土地证号：</label></th>
            <th>
                <div>
                    <input type="text" name="land_num" required  value="{{old('land_num')?old('land_num'):Session::get('land_num')}}" lay-verify="required" placeholder="请输入土地证号" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('land_num'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('land_num')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>
        <tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label>产权证号：</label></th>
            <th>
                <div>
                    <input type="text" name="house_property_num" required  value="{{old('house_property_num')?old('house_property_num'):Session::get('house_property_num')}}" lay-verify="required" placeholder="请输入产权证号" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('house_property_num'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('house_property_num')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>
        <tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label>不动产证号：</label></th>
            <th>
                <div>
                    <input type="text" name="immovable_num" required  value="{{old('immovable_num')?old('immovable_num'):Session::get('immovable_num')}}" lay-verify="required" placeholder="请输入不动产证号" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('immovable_num'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('immovable_num')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>
        <tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label>是否抵押：</label></th>
            <th>
                <div>
                    <input type="text" name="is_mortgage" required  value="{{old('is_mortgage')?old('is_mortgage'):Session::get('is_mortgage')}}" lay-verify="required" placeholder="填是或否" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('is_mortgage'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('is_mortgage')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>
        <tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label>房屋（证载）地址：</label></th>
            <th>
                <div>
                    <input type="text" name="house_card_address" required  value="{{old('house_card_address')?old('house_card_address'):Session::get('house_card_address')}}" lay-verify="required" placeholder="请输入房屋证载地址，例如：武汉市蔡甸区大集镇黄虎村1号" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('house_card_address'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('house_card_address')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>
        <tr>
            <th style="text-align: center;color:#666666;font-size: 14px">
                <label >身份证号:</label>
            </th>
            <th style="text-align: center">
                <div>
                    <input type="text" name="ID_card" required  value="{{old('ID_card')?old('ID_card'):Session::get('ID_card')}}" lay-verify="required" placeholder="请输入房屋产权人身份证号，如：420902199808086236" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('ID_card'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('ID_card')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>
        <tr>
            <th style="text-align: center;color:#666666;font-size: 14px">
                <label>联系方式:</label>
            </th>
            <th colspan="3">
                <div>
                    <input type="text" name="phone" required  lay-verify="required" value="{{old('phone')?old('phone'):Session::get('phone')}}" placeholder="请输入产权人联系方式，如：15828386898" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('phone'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('phone')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>
        <tr>

            <th style="text-align: center;color:#666666;font-size: 14px"><label >产别：</label></th>
            <th>
                <div>
                    <input type="text" name="ownership_type" required  value="{{old('ownership_type')?old('ownership_type'):Session::get('ownership_type')}}" lay-verify="required" placeholder="请输入产别类型" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('ownership_type'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('ownership_type')}}</sapn></span>
                    @endif
                </div>
            </th>

        </tr>
        <tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label>结构：</label></th>
            <th>
                <div>
                    <input type="text" name="house_structure" required  value="{{old('house_structure')?old('house_structure'):Session::get('house_structure')}}" lay-verify="required" placeholder="请输入房屋结构" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('built_year'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('built_year')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>
        <tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label>层次：</label></th>
            <th>
                <div>
                    <input type="text" name="house_level" required  value="{{old('house_level')?old('house_level'):Session::get('house_level')}}" lay-verify="required" placeholder="请输入房屋层次" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('house_level'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('house_level')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>
        <tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label>房屋性质：</label></th>
            <th>
                <div>
                    <input type="text" name="house_nature" required  value="{{old('house_nature')?old('house_nature'):Session::get('house_nature')}}" lay-verify="required" placeholder="请输入房屋性质" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('house_nature'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('house_nature')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>
        <tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label>房屋用途：</label></th>
            <th>
                <div>
                    <input type="text" name="house_use" required  value="{{old('house_use')?old('house_use'):Session::get('house_use')}}" lay-verify="required" placeholder="请输入房屋用途" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('house_use'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('house_use')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>
        <tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label>建成年份：</label></th>
            <th>
                <div>
                    <input type="text" name="built_year" required  value="{{old('built_year')?old('built_year'):Session::get('built_year')}}" lay-verify="required" placeholder="请输入房屋建成年份，例如：2018" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('built_year'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('built_year')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>
        <tr>

            <th style="text-align: center;color:#666666;font-size: 14px"><label >建筑面积（㎡）：</label></th>
            <th>
                <div>
                    <input type="text" name="built_area" required  value="{{old('built_area')?old('built_area'):Session::get('built_area')}}" lay-verify="required" placeholder="请输入产权人房屋面积，例如：356.5㎡，直接填写356.5" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('built_area'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('built_area')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>
        <tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label>证载面积（㎡）：</label></th>
            <th>
                <div>
                    <input type="text" name="house_card_area" required  value="{{old('house_card_area')?old('house_card_area'):Session::get('house_card_area')}}" lay-verify="required" placeholder="请输入房屋证载面积，例如，235.6㎡，直接填235.6" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('house_card_area'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('house_card_area')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>
        {{--<tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label>拆迁款：</label></th>
            <th>
                <div>
                    <input type="text" name="remove_money" required  value="{{old('remove_money')?old('remove_money'):Session::get('remove_money')}}" lay-verify="required" placeholder="请输入拆迁款，例如：635342.5" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('remove_money'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('remove_money')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>--}}
        {{--<tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label>补偿金：</label></th>
            <th>
                <div>
                    <input type="text" name="compensation_money" required  value="{{old('compensation_money')?old('compensation_money'):Session::get('compensation_money')}}" lay-verify="required" placeholder="请输入补偿金，例如：53465.8" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('compensation_money'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('compensation_money')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>--}}
       {{-- <tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label>劳务费：</label></th>
            <th>
                <div>
                    <input type="text" name="service_fee" required  value="{{old('service_fee')?old('service_fee'):Session::get('service_fee')}}" lay-verify="required" placeholder="请输入劳务费,例如：23456.8" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('service_fee'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('service_fee')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>--}}
        {{--<tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label>应付补偿总额：</label></th>
            <th>
                <div>
                    <input type="text" name="pay_money" required  value="{{old('pay_money')?old('pay_money'):Session::get('pay_money')}}" lay-verify="required" placeholder="请输入应付补偿金，例如：567345.8" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('pay_money'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('pay_money')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>--}}
        <tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label>备注：</label></th>
            <th>
                <div>
                    <input type="text" name="remark" required  value="{{old('remark')?old('remark'):Session::get('remark')}}" lay-verify="required" placeholder="请输入备注，可填写无" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('remark'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('remark')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>
        <tr>
            <th colspan="2" style="color:deeppink;font-size: 25px;text-align: center">
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit="" lay-filter="">确认新建</button>
                    </div>
                </div>
            </th>
        </tr>
        </div>
        </thead>
    </table>
    <div class="layui-form-item"><input type="hidden" id="promptMessage" name="promptMessage" value="{{Session::get('status')}}"></div>
</form>
</div>
{{--添加成功后的提示信息--}}
<script>
    layui.use(['layer'],function(){
        var layer=layui.layer;
        var msg=$("#promptMessage").val();
        if(msg!=""){
            layer.msg(msg);
        }
    });
</script>
{{--监听--}}
<script>
    $(function () {
        layui.use('form', function () {
            var $ = layui.jquery;
            var form = layui.form; //Tab的切换功能，切换事件监听等，需要依赖element模块
            form.on('select()', function(data){
                $("#videoNum").empty();
                var videoId=$("#changeVideo option:selected").val()
                var url="{{url('getVideoNum')}}";
                $.ajax({
                    url:url,
                    type:'POST',
                    data:{'videoId':videoId,'_token':"{{csrf_token()}}"},
                    success:function(response){
                        $("#videoNum").empty();
                        $("#videoNum").append(response);


                    }

                });
            });

        });

    });

</script>
{{--视频上传--}}
<script>

    layui.use('upload', function(){
        var upload = layui.upload;
        /*视频上传*/
        $(function () {
            var uploadInst = upload.render({
                elem: '#videos' //绑定元素
                ,field:'vid'
                ,accept:'video'
                ,acceptMime:'video/mkv'
                ,exts:'mkv|avi|wmv|mp4|rmvb|3gp|mov|avm|flv|m4v'
                ,size:1024*1024*10
                ,url: '/api/uploadVideo' //上传接口
                ,before: function(obj){
                    layer.load();
                }
                ,done: function(res){
                    layer.closeAll('loading'); //关闭loading
                    if(res.msg==1){
                        layer.msg('小主，影片上传成功哦！', {icon: 6});
                        $("#vid_url").val(res.url);
                        $('#tipMsg').text('(成功)');
                    }
                    //上传完毕回调
                }
                ,error: function(error){
                    layer.closeAll('loading'); //关闭loading
                    //请求异常回调
                    if(error.msg==0){
                        layer.msg('小主，影片上传失败啦！', {icon: 2});
                        $('#tipMsg').text('(失败)');
                    }
                }
            });
        });
    });

</script>
</body>
</html>